//Copyright 2010 Balazs Keri, Imre Keri
//
//This file is part of FireworksCreator.
//
//FireworksCreator is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//
//FireworksCreator is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with FireworksCreator.  If not, see <http://www.gnu.org/licenses/>.
//
#ifndef _VIEWATTRIBUTE_H
#define _VIEWATTRIBUTE_H
#include "viewattributegroup.h"
class Document;
//
class ViewAttribute {
   friend class ViewAttributeGroup;
public:
   //constructor
   ViewAttribute(const QSharedPointer<ViewAttributeGroup> &p_container, ViewAttributeName p_name);
   //destructor
   virtual ~ViewAttribute();
   //disabled
private:
   ViewAttribute(const ViewAttribute&);
   ViewAttribute &operator=(const ViewAttribute&);
   //data access
public:
   inline ViewAttributeName get_name() const{return name;}
   inline const QSharedPointer<ViewAttributeGroup> &get_container() const{return container;}
   inline Document *get_document() const{return container->get_document();}
   //for subclasses
protected:
   inline void emit_value_changed(View *origin){container->emit_value_changed(origin, this);}
   virtual void handle_post_primitive_pre_view(const Primitive &prim);
   virtual void handle_post_primitive_post_view(const Primitive &prim);
   //data
private:
   QSharedPointer<ViewAttributeGroup> container;
   ViewAttributeName name;
};
#endif //_VIEWATTRIBUTE_H
